import request from '@/utils/request'

// 删除对应的分类 非强制删除
export function delCategoryNotQuit(ids) {
	return request({
		url: '/admin/category/removeCategory',
		method: 'delete',
		data: ids
	})
}

// 删除对应的分类 强制删除
export function delCategory(ids) {
	return request({
		url: '/admin/category/removeCategoryQuit',
		method: 'delete',
		data: ids
	})
}

// 查询树形结构
export function listCategory(query) {
  return request({
    url: '/admin/category/findTreeCategoryList',
    method: 'get',
    params: query
  })
}

// 查询竞赛树形结构
export function listContestCategory(query) {
  return request({
    url: '/admin/category/findTreeContestCategoryList',
    method: 'get',
    params: query
  })
}

// 查询竞赛树形结构 --展开后
export function listExpandContestCategory(query) {
  return request({
    url: '/admin/category/findExpandContestCategoryList',
    method: 'get',
    params: query
  })
}

// 查询活动树形结构
export function listActivtyCategory(query) {
  return request({
    url: '/admin/category/findTreeActivityCategoryList',
    method: 'get',
    params: query
  })
}

// 查询文章树形结构
export function listBlogCategory(query) {
  return request({
    url: '/admin/category/findTreeBlogCategoryList',
    method: 'get',
    params: query
  })
}

// 新增分类
export function saveCategory(data) {
  return request({
    url: '/admin/category/saveCategory',
    method: 'post',
    data:data
  })
}

// 修改分类
export function updateCategory(data) {
  return request({
    url: '/admin/category/updateCategory',
    method: 'put',
    data:data
  })
}


// 根据分类查询
export function getCategoryInfo(id) {
  return request({
    url: `/admin/category/getCategoryInfo/${id}`,
    method: 'get',
  })
}

// 根据名称查询子节点
export function findCategoryChildListByName(name) {
  return request({
    url: `/admin/category/findCategoryChildListByName/${name}`,
    method: 'get',
  })
}

// 查询所有父分类
export function  findCategory1List() {
  return request({
    url: `/admin/category/findCategory1List`,
    method: 'get',
  })
}

// 查询所有父分类对应的子分类
export function  findCategory2List(id) {
  return request({
    url: `/admin/category/findCategory2List/${id}`,
    method: 'get',
  })
}